<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:p="http://primefaces.org/ui"
	xmlns:f="http://java.sun.com/jsf/core">
<h:head>
	<title>Thêm bài viết</title>
</h:head>
<style>
.addnews-lbl {
	float: left;
	min-width: 100px;
	margin-bottom: 4px;
}

.addnews-input {
	float: left;
	margin-bottom: 15px;
}

.div-addnews-child {
	width: 100%;
	float: left;
	margin-bottom: 10px;
}

.addnews-main {
	margin-left: 20px;
}
.
</style>
<body>

	<p:tabView>
		<!-- tab view thêm bài viết -->
		<p:tab title="Thêm tin tức">
			<h:panelGrid columns="1" cellpadding="10">
				<div class="addnews-main">
					<h:form enctype="multipart/form-data" id="id-addnews-baiviet"
						style="float:left;">
						<div class="div-addnews-child">
							<label class="addnews-lbl">Thể loại</label>
							<p:selectOneMenu styleClass="addnews-input"
								value="#{addnewsBean.idmuc}">
									<f:selectItem itemLabel="Nghề nghiệp" itemValue="1"></f:selectItem>
									<f:selectItem itemLabel="Hỏi đáp" itemValue="2"></f:selectItem>
									<f:selectItem itemLabel="Tin tức" itemValue="3"></f:selectItem>
									<p:ajax event="change" listener="#{addnewsBean.changeCboMuc()}" update="id-addnews-baiviet:id-addnews-cbo-theloai"></p:ajax>
							</p:selectOneMenu>
						</div>
						
						<h:panelGroup id="id-addnews-cbo-theloai">
							<div class="div-addnews-child">
								<label class="addnews-lbl">Thể loại</label>
								<p:selectOneMenu styleClass="addnews-input"
									value="#{addnewsBean.n300insert.idtheloai}">
									<f:selectItems value="#{addnewsBean.cboListN100}" var="n100"
										itemLabel="#{n100.tentheloai}" itemValue="#{n100.idtheloai}"></f:selectItems>
								</p:selectOneMenu>
							</div>
						</h:panelGroup>
						
						<div class="div-addnews-child">
							<label class="addnews-lbl">Tiêu đề VN</label>
							<h:inputText styleClass="addnews-input"
								value="#{addnewsBean.n300insert.tieude_vi}"></h:inputText>
						</div>
						<div class="div-addnews-child">
							<label class="addnews-lbl">Tiêu đề EN</label>
							<h:inputText styleClass="addnews-input"
								value="#{addnewsBean.n300insert.tieude_en}"></h:inputText>
						</div>


						<div class="div-addnews-child">
							<label class="addnews-lbl">Tóm tắt VN</label>
							<p:inputTextarea styleClass="addnews-input"
								value="#{addnewsBean.n300insert.tomtat_vi}" rows="2" cols="100"></p:inputTextarea>
						</div>
						<div class="div-addnews-child">
							<label class="addnews-lbl">Tóm tắt EN</label>
							<p:inputTextarea styleClass="addnews-input"
								value="#{addnewsBean.n300insert.tomtat_en}" rows="2" cols="100"></p:inputTextarea>
						</div>


						<div class="div-addnews-child">
							<label class="addnews-lbl">Nội dung VN</label>
							<p:editor styleClass="addnews-input"
								value="#{addnewsBean.n300insert.noidung_vi}" width="800"
								height="200"></p:editor>
						</div>
						<div class="div-addnews-child">
							<label class="addnews-lbl">Nội dung EN</label>
							<p:editor styleClass="addnews-input"
								value="#{addnewsBean.n300insert.noidung_en}" width="800"
								height="200"></p:editor>
						</div>

						<div class="div-addnews-child">
							<p:commandButton actionListener="#{addnewsBean.insertTabN300}"
								value="Lưu" update="id-addnews-baiviet">
							</p:commandButton>
						</div>
					</h:form>
					<h:form enctype="multipart/form-data" style="float:left;">
						<div class="div-addnews-child">
							<label class="addnews-lbl">Hình ảnh</label>
							<ui:remove>
								<h:inputFile value="#{addnewsBean.fileimage}" required="false">
									<f:ajax listener="#{addnewsBean.uploadimage}" render="@form" />
								</h:inputFile>
							</ui:remove>
							<p:fileUpload styleClass="addnews-input"
								value="#{addnewsBean.fileimage}"
								fileUploadListener="#{addnewsBean.uploadimage}" multiple="false"
								mode="advanced" sizeLimit="5242880"
								allowTypes="/(\.|\/)(gif|jpe?g|png)$/" previewWidth="200"
								cancelLabel="Hủy" label="Chọn file" uploadLabel="Tải lên"></p:fileUpload>

						</div>
					</h:form>
				</div>
			</h:panelGrid>
		</p:tab>
		<!--END tab view thêm bài viết -->

		<!-- tab view thêm thể loại -->
		<p:tab title="Thêm thể loại">
			<h:panelGrid columns="1" cellpadding="10">
				<p:row>
					<p:column>
						<div class="addnews-main" style="float: left; width: 30%;">
							<h:form enctype="multipart/form-data" id="id-addnews-theloai"
								style="float:left;">
								<div class="div-addnews-child">
									<label class="addnews-lbl">Mục</label>
									<p:selectOneMenu styleClass="addnews-input"
										value="#{addnewsBean.n100insert.idmuc}">
										<f:selectItem itemLabel="Nghề nghiệp" itemValue="1"></f:selectItem>
										<f:selectItem itemLabel="Hỏi đáp" itemValue="2"></f:selectItem>
										<f:selectItem itemLabel="Tin tức" itemValue="3"></f:selectItem>
										<p:ajax event="change"></p:ajax>
									</p:selectOneMenu>
								</div>
								<div class="div-addnews-child">
									<label class="addnews-lbl">Thể loại VN</label>
									<h:inputText styleClass="addnews-input"
										value="#{addnewsBean.n100insert.tentheloai_vi}"></h:inputText>
								</div>
								<div class="div-addnews-child">
									<label class="addnews-lbl">Thể loại EN</label>
									<h:inputText styleClass="addnews-input"
										value="#{addnewsBean.n100insert.tentheloai_en}"></h:inputText>
								</div>

								<div class="div-addnews-child">
									<p:commandButton actionListener="#{addnewsBean.insertTabN100}"
										value="Lưu" update="id-addnews-theloai">
									</p:commandButton>
								</div>
							</h:form>
							<h:form enctype="multipart/form-data" style="float:left;">
								<div class="div-addnews-child">
									<label class="addnews-lbl">Hình ảnh</label>
									<p:fileUpload styleClass="addnews-input"
										value="#{addnewsBean.fileimage}"
										fileUploadListener="#{addnewsBean.uploadimage_theloai}"
										multiple="false" mode="advanced" sizeLimit="5242880"
										allowTypes="/(\.|\/)(gif|jpe?g|png)$/" previewWidth="200"
										cancelLabel="Hủy" label="Chọn file" uploadLabel="Tải lên"></p:fileUpload>

								</div>
							</h:form>
						</div>
					</p:column>

					<p:column>
						<p:dataTable></p:dataTable>
					</p:column>
				</p:row>


			</h:panelGrid>
		</p:tab>
		<!-- tab view thêm thể loại -->
	</p:tabView>

</body>
</html>